var mapIds = [993173450];
var 准备地图 = 993173500;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("荣耀活动_扫荡黑太阳_摧毁传送门");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully()
    }
    for (var b = 1; b <= 5; b++) {
        c.setProperty("cannon" + b, 3);
        c.setProperty("cannonPlayer" + b, 0)
    }
    return c
}

function 传送门出现(a) {
    a.getPlayers().forEach(function (b) {
        b.getAPI().getWeatherEffectNotice("传送门再次被激活！请速速破坏传送门！", 297, 10000, 1)
    })
}

function 大炮出现1(a) {
    a.setProperty("cannon1", 3);
    a.getPlayers().forEach(function (b) {
        b.getAPI().cerniumCannonShow(1, 16, -850, -90)
    })
}

function 大炮出现2(a) {
    a.setProperty("cannon2", 3);
    a.getPlayers().forEach(function (b) {
        b.getAPI().cerniumCannonShow(2, 15, -850, -300)
    })
}

function 大炮出现3(a) {
    a.setProperty("cannon3", 3);
    a.getPlayers().forEach(function (b) {
        b.getAPI().cerniumCannonShow(3, 14, -850, -510)
    })
}

function 大炮出现4(a) {
    a.setProperty("cannon4", 3);
    a.getPlayers().forEach(function (b) {
        b.getAPI().cerniumCannonShow(4, 13, -850, -720)
    })
}

function 大炮出现5(a) {
    a.setProperty("cannon5", 3);
    a.getPlayers().forEach(function (b) {
        b.getAPI().cerniumCannonShow(5, 12, -850, -930)
    })
}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0))
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    em.setProperty("kill", "0");
    em.setProperty("level", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a);
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onMonsterDamaged(b, a, d, e, c) {}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(b, d, c) {
    if (d == 9833664) {
        player.getAPI().addNumberForQuestInfo(100347, "gate", 1);
        player.getAPI().getWeatherEffectNotice("成功破坏黑太阳士兵的传送门！", 297, 10000, 1);
        b.schedule("传送门出现", 120 * 1000)
    } else {
        var a = player.getAPI().addNumberForQuestInfo(100347, "kill", 1);
        if (a % 35 == 0) {
            player.getAPI().addNumberForQuestInfo(100347, "bomb", 1);
            player.getAPI().getTopMsgFont("获得了1枚炮弹。", 4, 20, 20, 0, 0);
            player.getAPI().effect_OnUserEff("Effect/OnUserEff.img/glory_E4mission2")
        }
    }
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function onItemPickedUp(b, a, c) {};